package com.javatraining.corejava.homework.customer;

/**
 * @author kmatharasi
 * 
 * Class that defines Customer state and behavior.
 *
 */
  public class Customer {
	// below are the different states that are useful to define a Customer .
		
	  private String customerName;
	  
	  private String customerID;
		
      private String customerAddress;
		  
	  private int age;
		
	  private int rewardPoints;
		
	  private int numberOfpurchases;
		
	  private long customerPhoneNumber;
		
	  private boolean newCustomer=false;
		
	  public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getCustomerID() {
		return customerID;
	}

	public void setCustomerID(String customerID) {
		this.customerID = customerID;
	}

	public String getCustomerAddress() {
		return customerAddress;
	}

	public void setCustomerAddress(String customerAddress) {
		this.customerAddress = customerAddress;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public int getRewardPoints() {
		return rewardPoints;
	}

	public void setRewardPoints(int rewardPoints) {
		this.rewardPoints = rewardPoints;
	}

	public int getNumberOfpurchases() {
		return numberOfpurchases;
	}

	public void setNumberOfpurchases(int numberOfpurchases) {
		this.numberOfpurchases = numberOfpurchases;
	}

	public long getCustomerPhoneNumber() {
		return customerPhoneNumber;
	}

	public void setCustomerPhoneNumber(long customerPhoneNumber) {
		this.customerPhoneNumber = customerPhoneNumber;
	}

	public boolean isNewCustomer() {
		return newCustomer;
	}

	public void setNewCustomer(boolean newCustomer) {
		this.newCustomer = newCustomer;
	}




	
	// below are the different behavior that are useful to define a Customer .
	
	
	public void checkIfNewCustomer(int numberOfpurchases)

	{
		
	this.numberOfpurchases=numberOfpurchases;
	if(numberOfpurchases==0)
	
	{
	System.out.println("You are our new customer,Welcome !"); 
	System.out.println("------------------------------------");
	
	}
	
	else
	{
		
		System.out.println("You are our existing customer,Welcome Back!"); 
		System.out.println("--------------------------------------------");
	}
	
	}
	
	public void getCustomerInfo()
	{
		if(!newCustomer)
		{
			System.out.println("Name of the customer"+ " " +  customerName);
			System.out.println("------------------------------------------");
			System.out.println("Addres of teh customer" + " " +  customerAddress);
			System.out.println("----------------------------------------------");
		}
		
		
	}
	
	public void giveRewardPointsToCustomer(int  numberOfpurchases)
	{
		this.numberOfpurchases= numberOfpurchases;
		switch(numberOfpurchases)
		{
		case 1: System.out.println("Reward Points = 100");
		System.out.println("-----------------------------");
		break;
		
		case 2: System.out.println("Reward Points = 200");
		System.out.println("-----------------------------");
		break;
		
		case 3: System.out.println("Reward Points = 300");
		System.out.println("-----------------------------");
		break;
		
		case 4: System.out.println("Reward Points = 400");
		System.out.println("-----------------------------");
		break;
		
		default: System.out.println("Reward Points = 500");
		System.out.println("-----------------------------");
		break;
			
		
		}
		
	}
		
	public void giveCustomerDiscount(int rewardPoints)
		
		{   
		    this.rewardPoints = rewardPoints;
			
      		if (rewardPoints >0 && rewardPoints <= 100 )
      			
      		{
				System.out.println("Discount you get is 5%");
      		   System.out.println("-----------------------------");
      		}
			
			else if (rewardPoints >100 && rewardPoints <= 200 )
			{
				System.out.println("Discount you get is 10%");
      		System.out.println("-----------------------------");
      		
			}
			
			
			else  if (rewardPoints >300 && rewardPoints <= 400 )
				
			{
				System.out.println("Discount you get is 20%");
	      		System.out.println("-----------------------------");
				
			}
		
			else
			{
			
			System.out.println("Discount you get is 25%");	
      		System.out.println("-----------------------------");
      		
			}
			
			
		}
		
		
	
	public    void shipCouponsToCustomer(int numberOfpurchases)
	
	
	{
		this.numberOfpurchases = numberOfpurchases;
		if(numberOfpurchases>10)
		{
			System.out.println("Shiiping your coupons");
      		System.out.println("-----------------------------");
			
		}
		
		else
		{
			System.out.println("You are not eligible for coupons .");
			System.out.println("-----------------------------");
		}
	}


	
	
	

}
